package com.cc2019.buke.home.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.cc2019.buke.R;
import com.cc2019.buke.home.entry.Product3;
import com.cc2019.buke.home.entry.Product4;

public class ProActivity extends AppCompatActivity {
    private Product4 product;
    private ImageView imageView;
    private TextView priceView;
    private TextView nameView;
    private TextView totalPrice;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pro);
        imageView = findViewById(R.id.pro_img);
        priceView = findViewById(R.id.pro_price);
        totalPrice = findViewById(R.id.pro_total);
        nameView = findViewById(R.id.pro_name);
        Intent intent = this.getIntent();
        product = (Product4) intent.getSerializableExtra("product");
        initView();
    }
    public void initView(){
        double price = product.getPrice();
        int img = product.getImgId();
        double total = product.getTotal();
        String name = product.getName();
        nameView.setText(name);
        imageView.setImageResource(img);
        priceView.setText("拼团价"+price);
        totalPrice.setText("已拼"+total+"万件");

    }
}